package com.ruoyi.delivery.service.impl;


import com.ruoyi.delivery.domain.DelOperatorTransportDetail;
import com.ruoyi.delivery.domain.DelTransportDetail;
import com.ruoyi.delivery.mapper.DelOperatorTransportDetailMapper;
import com.ruoyi.delivery.service.IDelOperatorTransportDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 运输订单明细 服务层实现
 *
 * @author skye
 */
@Service
public class DelOperatorTransportDetailServiceImpl implements IDelOperatorTransportDetailService {

    @Autowired
    private DelOperatorTransportDetailMapper operatorTransportDetailMapper;

    /**
     * 根据 trackingNumber 获取所有运单明细
     *
     * @param trackingNumber 运单号
     * @return 运单明细列表
     */
    @Override
    public List<DelOperatorTransportDetail> getDetailsByTrackingNumber(String trackingNumber) {
        return operatorTransportDetailMapper.getDetailsByTrackingNumber(trackingNumber);
    }

    @Override
    public List<DelOperatorTransportDetail> getDetailsByOrderNumber(String orderNumber) {
        return operatorTransportDetailMapper.getDetailsByOrderNumber(orderNumber);
    }

    /**
     * 插入运单明细
     *
     * @param detail 运单明细对象
     * @return 影响的行数
     */
    @Override
    public boolean insertOperatorTransportDetail(DelOperatorTransportDetail detail) {
        return operatorTransportDetailMapper.insertOperatorTransportDetail(detail)>0;
    }

    /**
     * 删除运单明细
     *
     * @param transportDetailId 运单明细编号
     * @return 影响的行数
     */
    @Override
    public boolean deleteOperatorTransportDetail(String transportDetailId) {
        return operatorTransportDetailMapper.deleteOperatorTransportDetail(transportDetailId)>0;
    }

    /**
     * 修改运单明细
     *
     * @param detail 运单明细对象
     * @return 影响的行数
     */
    @Override
    public boolean updateOperatorTransportDetail(DelOperatorTransportDetail detail) {
        return operatorTransportDetailMapper.updateOperatorTransportDetail(detail)>0;
    }

    @Override
    public List<DelOperatorTransportDetail> searchOperatorTransportDetails(String trackingNumber,String productName, String orderNumber, String productBatch) {
        return operatorTransportDetailMapper.searchOperatorTransportDetails(trackingNumber,productName, orderNumber, productBatch);
    }
}
